package com.ljk;

//

import com.sun.jna.Native;
import com.sun.jna.ptr.IntByReference;

public class JnaDllExample {

    public static void main(String[] args) {
        //加载动态库
        DllDemoLibrary dll = Native.load("DllDemo.dll", DllDemoLibrary.class);

        dll.helloworld();

        int addR = dll.add(2, 3);
        System.out.println("add: 2 + 3 = " + addR);
        int subR = dll.sub(2, 1);
        System.out.println("sub: 2 - 1 = " + subR);

        IntByReference num = new IntByReference(1);
        dll.modifyValue(num);
        System.out.println("num = " + num.getValue());

        //ByteByReference
        //DoubleByReference
        //FloatByReference
        //IntByReference
        //LongByReference
        //NativeLongByReference
        //PointerByReference
        //ShortByReference
    }
}
